SQL=

SELECT 
	T_RSTATEMENT_INS.Name,
	T_RSTATEMENT_INS.DateAcct,
	T_RSTATEMENT_INS.AmtAcctCr,
	T_RSTATEMENT_INS.AmtAcctDr,
	(SELECT 
		NVL(TRIM(TO_CHAR(Fact_Acct.Fact_Acct_ID)),'') 
	FROM 
		Fact_Acct 
	WHERE 
		T_RSTATEMENT_INS.Fact_Acct_ID=Fact_Acct.Fact_Acct_ID) AS AFact_Acct_ID,
	T_RSTATEMENT_INS.Fact_Acct_ID AS 	Fact_Acct_ID,
	T_RSTATEMENT_INS.Balance,
	T_RSTATEMENT_INS.Description,
	T_RSTATEMENT_INS.LevelNo,
	(SELECT 
		NVL(TRIM(TO_CHAR(AD_PInstance.AD_PInstance_ID)),'')||' - '||NVL((SELECT NVL(AD_Process.Value,'')||' - '||NVL(AD_Process.Name,'') 
	FROM 
		AD_Process 
	WHERE 
		AD_PInstance.AD_Process_ID =AD_Process.AD_Process_ID),'') FROM AD_PInstance WHERE T_RSTATEMENT_INS.AD_PInstance_ID=AD_PInstance.AD_PInstance_ID) AS BAD_PInstance_ID,T_RSTATEMENT_INS.AD_PInstance_ID AS AD_PInstance_ID,T_RSTATEMENT_INS.Qty,T_RSTATEMENT_INS.RUNNING_BAL FROM T_RSTATEMENT_INS WHERE (T_RSTATEMENT_INS.AD_PInstance_ID=1001239) AND T_RSTATEMENT_INS.AD_Client_ID IN(0,1000002) AND T_RSTATEMENT_INS.AD_Org_ID IN(0,1000004) ORDER BY T_RSTATEMENT_INS.Name [11]
